1use crate::re::NiBound::NiBound;
2use crate::re::NiCollisionObject::NiCollisionObject;
3use crate::re::NiObjectNET::NiObjectNET;
4use crate::re::NiSmartPointer::NiPointer;
5use crate::re::NiTransform::NiTransform;
6use crate::re::offsets_ni_rtti::NiRTTI_NiObject;
7use crate::re::offsets_rtti::RTTI_NiObject;
8use crate::re::offsets_vtable::VTABLE_NiObject;
9use crate::re::{NiNode, bhkCollisionObject};
10use crate::rel::id::VariantID;
11use crate::rel::relocation::{RelocationError, relocate_member, relocate_member_mut};
12use core::ffi::{c_float, c_void};
13
14#[repr(u32)]
15#[derive(Debug, Clone, Copy)]
16pub enum NiUpdateData_Flag {
17 None = 0,
18 Dirty = 1 << 0,
19 DisableCollision = 1 << 13,
20}
21
22#[repr(C)]
23#[derive(Debug)]
24pub struct NiUpdateData {
25 pub time: c_float, pub flags: NiUpdateData_Flag, }
28
29#[repr(C)]
30pub struct PerformOpFuncVtbl {
31 pub CxxDrop: unsafe extern "C" fn(this: *mut c_void), pub CxxOperatorCall: unsafe extern "C" fn(*mut c_void, *mut NiAVObject) -> bool, }
36
37#[repr(C)]
38pub struct PerformOpFunc {
39 pub vtable: *const PerformOpFuncVtbl, }
41
42#[repr(C)]
43#[derive(Debug)]
44pub struct NiAVObject {
45 pub __base: NiObjectNET,
46 pub parent: *mut NiNode, pub parent_index: u32, pub unk03C: u32, pub collision_object: NiPointer<NiCollisionObject>, pub local_transform: NiTransform, pub world_transform: NiTransform, pub previous_world_transform: NiTransform, pub world_bound: NiBound, pub unk_f4: u32, pub unk_f8: u64, pub fade_amount: c_float, pub last_updated_frame_counter: u32, pub unk104: u64, }
60
61const _: () = {
62 assert!(core::mem::offset_of!(NiAVObject, __base) == 0x0);
63 assert!(core::mem::offset_of!(NiAVObject, parent) == 0x30);
64 assert!(core::mem::offset_of!(NiAVObject, parent_index) == 0x38);
65 assert!(core::mem::offset_of!(NiAVObject, unk03C) == 0x3C);
66 assert!(core::mem::offset_of!(NiAVObject, collision_object) == 0x40);
67 assert!(core::mem::offset_of!(NiAVObject, local_transform) == 0x48);
68 assert!(core::mem::offset_of!(NiAVObject, world_transform) == 0x7C);
69 assert!(core::mem::offset_of!(NiAVObject, previous_world_transform) == 0xB0);
70 assert!(core::mem::offset_of!(NiAVObject, world_bound) == 0xE4);
71 assert!(core::mem::offset_of!(NiAVObject, unk_f4) == 0xF4);
72 assert!(core::mem::offset_of!(NiAVObject, unk_f8) == 0xF8);
73 assert!(core::mem::offset_of!(NiAVObject, fade_amount) == 0x100);
74 assert!(core::mem::offset_of!(NiAVObject, last_updated_frame_counter) == 0x104);
75 assert!(core::mem::offset_of!(NiAVObject, unk104) == 0x108);
76 assert!(core::mem::size_of::<NiAVObject>() == 0x110);
77};
78
79impl NiAVObject {
80 pub const RTTI: VariantID = RTTI_NiObject;
81 pub const NI_RTTI: VariantID = NiRTTI_NiObject;
82 pub const VTABLE: [VariantID; 1] = VTABLE_NiObject;
83
84 #[must_use]
85 #[commonlibsse_ng_derive_internal::relocate_fn(se_id = 68835, ae_id = 70187)]
86 pub fn clone(&self) -> *mut NiAVObject {}
87
88 #[inline]
110 pub fn get_app_culled(&self) -> bool {
111 self.get_flags().is_ok_and(|flag_member| flag_member.contains(Flag::Hidden))
112 }
113
114 #[commonlibsse_ng_derive_internal::relocate_fn(se_id = 25482, ae_id = 26022)]
115 pub fn get_collision_object(&self) -> *mut bhkCollisionObject {}
116
117 #[inline]
225 pub fn get_flags(&self) -> Result<&Flag, RelocationError> {
226 relocate_member(self, 0x0F4, 0x10C)
227 }
228
229 #[inline]
231 pub fn get_flags_mut(&mut self) -> Result<&mut Flag, RelocationError> {
232 relocate_member_mut(self, 0x0F4, 0x10C)
233 }
234
235 }
242
243impl crate::re::NiSmartPointer::RefCountable for NiAVObject {
244 #[inline]
245 fn inc_ref_count(&self) {
246 self.__base.__base.__base.inc_ref_count();
247 }
248
249 #[inline]
250 fn dec_ref_count(&mut self) {
251 self.__base.__base.__base.dec_ref_count();
252 }
253}
254
255#[repr(C)]
256pub struct NiAVObjectVtbl {
257 pub cxx_drop: unsafe extern "C" fn(this: *mut c_void), pub GetRTTI: unsafe extern "C" fn(this: *const c_void) -> *const c_void, pub LoadBinary: unsafe extern "C" fn(this: *mut c_void, stream: *mut c_void), pub LinkObject: unsafe extern "C" fn(this: *mut c_void, stream: *mut c_void), pub RegisterStreamables: unsafe extern "C" fn(this: *mut c_void, stream: *mut c_void) -> bool, pub SaveBinary: unsafe extern "C" fn(this: *mut c_void, stream: *mut c_void), pub IsEqual: unsafe extern "C" fn(this: *mut c_void, object: *mut c_void) -> bool, pub ProcessClone: unsafe extern "C" fn(this: *mut c_void, cloning: *mut c_void), pub UpdateControllers: unsafe extern "C" fn(this: *mut c_void, data: *mut c_void), pub ApplyLocalTransformToWorld: Option<unsafe extern "C" fn(this: *mut c_void)>, pub PerformOp: Option<unsafe extern "C" fn(this: *mut c_void, func: *mut c_void)>, pub AttachProperty: Option<unsafe extern "C" fn(this: *mut c_void, property: *mut c_void)>, pub SetMaterialNeedsUpdate: Option<unsafe extern "C" fn(this: *mut c_void, needs_update: bool)>, pub SetDefaultMaterialNeedsUpdateFlag:
278 Option<unsafe extern "C" fn(this: *mut c_void, flag: bool)>, pub GetObjectByName:
280 Option<unsafe extern "C" fn(this: *mut c_void, name: *mut c_void) -> *mut c_void>, pub SetSelectiveUpdateFlags: Option<
282 unsafe extern "C" fn(
283 this: *mut c_void,
284 a_selective_update: bool,
285 a_selective_update_transforms: bool,
286 a_rigid: bool,
287 ),
288 >, pub UpdateDownwardPass:
290 Option<unsafe extern "C" fn(this: *mut c_void, data: *mut c_void, arg2: u32)>, pub UpdateSelectedDownwardPass:
292 Option<unsafe extern "C" fn(this: *mut c_void, data: *mut c_void, arg2: u32)>, pub UpdateRigidDownwardPass:
294 Option<unsafe extern "C" fn(this: *mut c_void, data: *mut c_void, arg2: u32)>, pub UpdateWorldBound: Option<unsafe extern "C" fn(this: *mut c_void)>, pub UpdateWorldData: Option<unsafe extern "C" fn(this: *mut c_void, data: *mut c_void)>, pub UpdateTransformAndBounds:
298 Option<unsafe extern "C" fn(this: *mut c_void, data: *mut c_void)>, pub PreAttachUpdate:
300 Option<unsafe extern "C" fn(this: *mut c_void, parent: *mut c_void, data: *mut c_void)>, pub PostAttachUpdate: Option<unsafe extern "C" fn(this: *mut c_void)>, pub OnVisible: Option<unsafe extern "C" fn(this: *mut c_void, process: *mut c_void)>, }
304
305bitflags::bitflags! {
306 #[derive(Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord)]
308 pub struct Flag: u32 {
309 const None = 0;
310 const Hidden = 1 << 0;
311 const SelectiveUpdate = 1 << 1;
312 const SelectiveUpdateTransforms = 1 << 2;
313 const SelectiveUpdateController = 1 << 3;
314 const SelectiveUpdateRigid = 1 << 4;
315 const DisplayObject = 1 << 5;
316 const DisableSorting = 1 << 6;
317 const SelectiveUpdateTransformsOverride = 1 << 7;
318 const SaveExternalGeometryData = 1 << 9;
319 const NoDecals = 1 << 10;
320 const AlwaysDraw = 1 << 11;
321 const MeshLOD = 1 << 12;
322 const FixedBound = 1 << 13;
323 const TopFadeNode = 1 << 14;
324 const IgnoreFade = 1 << 15;
325 const NoAnimSyncX = 1 << 16;
326 const NoAnimSyncY = 1 << 17;
327 const NoAnimSyncZ = 1 << 18;
328 const NoAnimSyncS = 1 << 19;
329 const NoDismember = 1 << 20;
330 const NoDismemberValidity = 1 << 21;
331 const RenderUse = 1 << 22;
332 const MaterialsApplied = 1 << 23;
333 const HighDetail = 1 << 24;
334 const ForceUpdate = 1 << 25;
335 const PreProcessedNode = 1 << 26;
336 }
337}